package com.qanda.tools;

import java.io.InputStream;
import java.net.HttpURLConnection;
import java.net.URL;
import android.graphics.Bitmap;
import android.graphics.BitmapFactory;

public class ImageExtractor {
	
	public static Bitmap extractBitmap(String urlPath)
	{
		Bitmap bmImg;
        URL myFileUrl = null;
        
        try
        {
        	myFileUrl= new URL(urlPath);
        	HttpURLConnection conn = null;
        	conn = (HttpURLConnection)myFileUrl.openConnection();
        	conn.setDoInput(true);
        	conn.connect();
        	
        	//int length = conn.getContentLength();
        	
        	InputStream is = null;
        	is = conn.getInputStream();
        	bmImg = BitmapFactory.decodeStream(is);
        	return bmImg;
        }
        catch(Exception ex){return null;}
	}
}
